package cn.tedu.property_management_system.controller;

import cn.tedu.property_management_system.service.ReportForRepairService;
import cn.tedu.property_management_system.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/report/for/repair")
public class ReportForRepairController {

    @Autowired
    private ReportForRepairService service;

    @GetMapping("/type")
    public JsonResult<List<String>> getListType() {
        List<String> list = service.typeList();
        log.debug(list+"type");
        return JsonResult.OK(list);
    }

    @GetMapping("/data")
    public JsonResult<List<Integer>> getListData() {
        List<Integer> list = service.dataList();
        log.debug(list+"-----------------------------------------------------------");
        return JsonResult.OK(list);
    }

    @GetMapping("/compliant")
    public JsonResult<List<String>> getListCompliant() {
        List<String> list = service.compliantTypeList();
        log.debug(list+"-------------------------------------------------------------");
        return JsonResult.OK(list);
    }

    @GetMapping("/compliant/data")
    public JsonResult<List<Integer>> getListCompliantData() {
        List<Integer> list = service.complaintList();
        log.debug(list+"data");
        return JsonResult.OK(list);
    }

}
